#include  <cstdio>

int main(int argc, char *argv[])
{
	int a[20];
	while(scanf("%d",&a[0]) && a[0] != -1)
	{
		int i = 1;
		while( scanf("%d",&a[i++]) && a[i-1] != 0 );
		int sum = 0;
		for( int m = 0; m < i-1 ; ++m )
		{
			for( int n = 0; n < i-1 ; ++n )
			{
				if(a[m]*2 == a[n])
					sum++;
			}
			
		}
		printf("%d\n",sum);
	}
}
